package com.suredy.app.project.model;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.suredy.core.model.BaseModel;
import com.suredy.security.entity.UserEntity;

/**
 * 项目成员
 * 
 * @author VIVID.G
 * @since 2015-7-30
 * @version v0.1
 */
@Entity
@Table(name = "tb_project_member")
public class ProjectMember extends BaseModel {

	private static final long serialVersionUID = 1L;

	/* 关联人员信息 */
	@ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.EAGER)
	@JoinColumn(name = "user_id")
	private UserEntity user;

	/* 是否为项目经理 */
	@Column(nullable = false, columnDefinition = "int default 0")
	private Boolean manager;

	@ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.LAZY)
	@JoinColumn(name = "project_id")
	private Project project;

	public UserEntity getUser() {
		return user;
	}

	public void setUser(UserEntity user) {
		this.user = user;
	}

	public Boolean getManager() {
		return manager;
	}

	public void setManager(Boolean manager) {
		this.manager = manager;
	}

	public Project getProject() {
		return project;
	}

	public void setProject(Project project) {
		this.project = project;
	}

}
